from langchain_core.output_parsers import StrOutputParser
from langchain_openai import ChatOpenAI

# model = ChatOpenAI(model="ictrek/qwen7b:32k",
#                    openai_api_key="ollama",
#                    openai_api_base="http://10.2.4.31:11434/v1/")

# http://10.2.42.9:8112/v1
model = ChatOpenAI(model="deepseek-r1-qwen-32b",
                   openai_api_key="ollama",
                   openai_api_base="http://10.2.42.9:8112/v1")
lang = "英语"
text = "您好，有什么可以帮助您的？"
msg = [{
    "role": "system",
    "content": f"你是一个翻译专家，请将以下的内容翻译为{lang}"
}, {
    "role": "user",
    "content": f"{text}"
}]

parser = StrOutputParser()

chain = model | parser

print(chain.invoke(msg))
